package com.ysd.servlet;

import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ysd.dao.impl.DetailsinfoDaoimpl;
import com.ysd.dao.impl.NewsTableDaoImpl;
import com.ysd.entity.Detailsinfo;
import com.ysd.entity.NewsTable;


public class NewsServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		NewsTableDaoImpl xinwen = new NewsTableDaoImpl();
		List<NewsTable> list = xinwen.getNewsTable();
		request.setAttribute("list", list);
		
		int did = Integer.parseInt(request.getParameter("nid"));
		DetailsinfoDaoimpl dDao = new DetailsinfoDaoimpl();
		List<Detailsinfo> Detailsinfo=dDao.Detailsinfo(did);
		request.setAttribute("dlist",Detailsinfo);
		request.getRequestDispatcher("article_list.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
